import finance.InvestmentItem 
import finance.InvestmentType 
import finance.User 

class BootStrap {

     def init = { servletContext ->
     		println "In BootStrap::init now"
     		(new User(id: 1, version: 0, user_name: "qwerty", password: "qwerty")).save()
     		(new User(id: 2, version: 0, user_name: "asdfgh", password: "asdfgh")).save()
     		
     		(new InvestmentType(id: 1, version: 0, investment_type: "CASH", auto_update: true)).save()
     		(new InvestmentType(id: 2, version: 0, investment_type: "REAL ESTATE", auto_update: false)).save()
     		(new InvestmentType(id: 3, version: 0, investment_type: "CD / FD", auto_update: false)).save()
     		(new InvestmentType(id: 4, version: 0, investment_type: "STOCK", auto_update: true)).save()
     		(new InvestmentType(id: 5, version: 0, investment_type: "MUTUAL FUND", auto_update: true)).save()
     		(new InvestmentType(id: 6, version: 0, investment_type: "COMMODITY", auto_update: true)).save()
     		
     		(new InvestmentItem(id: 1, version: 0, symbol: "REAL ESTATE", name: "Real Estate", latest_price: 1, last_updated: "04/03/2010", type: InvestmentType.get(2))).save()
     		(new InvestmentItem(id: 2, version: 0, symbol: "CDFD", name: "Certificate of Deposit", latest_price: 1, last_updated: "04/03/2010", type: InvestmentType.get(3))).save()
     		(new InvestmentItem(id: 3, version: 0, symbol: "INR", name: "Indian Rupees", latest_price: 1, last_updated: "04/03/2010", type: InvestmentType.get(1))).save()
     		(new InvestmentItem(id: 4, version: 0, symbol: "USD", name: "USA Dollars", latest_price: 45, last_updated: "04/03/2010", type: InvestmentType.get(1))).save()
     		(new InvestmentItem(id: 5, version: 0, symbol: "GOLD", name: "Gold", latest_price: 18000, last_updated: "04/03/2010", type: InvestmentType.get(6))).save()
     		(new InvestmentItem(id: 6, version: 0, symbol: "SILVER", name: "Silver", latest_price: 5000, last_updated: "04/03/2010", type: InvestmentType.get(6))).save()
     		(new InvestmentItem(id: 7, version: 0, symbol: "ICICI", name: "ICICI Bank", latest_price: 323.44, last_updated: "04/03/2010", type: InvestmentType.get(4))).save()
     }
     def destroy = {
    		 println "In BootStrap::destroy now"
     }
}